// eslint-disable-next-line no-unused-vars
import VXETable, { Column } from 'vxe-table'
import createBem from '@Components/assets/js/utils/bem'
import { tableNamespace } from '../../../config'

const Bem = createBem(`${tableNamespace}__progress`)

VXETable.renderer.add('Progress', {
  renderDefault(h, renderOpts, { row, column }) {
    const { options = {} } = renderOpts
    const value = row[column.property]

    return [
      <div class={Bem()}>
        <el-progress percentage={value} props={options} />
      </div>
    ]
  }
})

/** @type { Column } */
export const options = {
  showOverflow: 'ellipsis',
  align: 'left',
  headerAlign: 'center'
}
